package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.UserPointsLogMapper;
import com.hello.system.domain.UserPointsLog;
import com.hello.system.service.IUserPointsLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 用户积分变动日志Service业务层处理
 * 
 * @author hello
 * @date 2025-10-29
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class UserPointsLogServiceImpl extends ServiceImpl<UserPointsLogMapper, UserPointsLog> implements IUserPointsLogService 
{
    private final UserPointsLogMapper userPointsLogMapper;

    /**
     * 查询用户积分变动日志
     * 
     * @param id 用户积分变动日志主键
     * @return 用户积分变动日志
     */
    @Override
    public UserPointsLog selectUserPointsLogById(Long id)
    {
        return userPointsLogMapper.selectUserPointsLogById(id);
    }

    /**
     * 查询用户积分变动日志列表
     * 
     * @param userPointsLog 用户积分变动日志
     * @return 用户积分变动日志
     */
    @Override
    public List<UserPointsLog> selectUserPointsLogList(UserPointsLog userPointsLog)
    {
        return userPointsLogMapper.selectUserPointsLogList(userPointsLog);
    }

    /**
     * 新增用户积分变动日志
     * 
     * @param userPointsLog 用户积分变动日志
     * @return 结果
     */
    @Override
    public int insertUserPointsLog(UserPointsLog userPointsLog)
    {
        userPointsLog.setCreateTime(DateUtils.getNowDate());
        return userPointsLogMapper.insertUserPointsLog(userPointsLog);
    }

    /**
     * 修改用户积分变动日志
     * 
     * @param userPointsLog 用户积分变动日志
     * @return 结果
     */
    @Override
    public int updateUserPointsLog(UserPointsLog userPointsLog)
    {
        userPointsLog.setUpdateTime(DateUtils.getNowDate());
        return userPointsLogMapper.updateUserPointsLog(userPointsLog);
    }


    /**
     * 批量删除用户积分变动日志
     * 
     * @param ids 需要删除的用户积分变动日志主键
     * @return 结果
     */
    @Override
    public int deleteUserPointsLogByIds(Long[] ids)
    {
        return userPointsLogMapper.deleteUserPointsLogByIds(ids);
    }

    /**
     * 删除用户积分变动日志信息
     * 
     * @param id 用户积分变动日志主键
     * @return 结果
     */
    @Override
    public int deleteUserPointsLogById(Long id)
    {
        return userPointsLogMapper.deleteUserPointsLogById(id);
    }
}
